package cn.xiaolang.function.enum_interface;

/**
 * 枚举实现接口的扩展
 *
 * @author fuhw/Dean
 * @date 2019-06-10
 */
public enum ComplexOperation implements Operation {

    EXP("^") {
        @Override
        public double apply(double x, double y) {
            return Math.pow(x, y);
        }
    },
    REMAINDER("%") {
        @Override
        public double apply(double x, double y) {
            return x % y;
        }
    };

    private String symbol;

    ComplexOperation(String symbol) {
        this.symbol = symbol;
    }

    public static void main(String[] args) {
        System.out.println(ComplexOperation.EXP.apply(2, 4));
    }
}
